package utils

import (
	"net"
	"strings"
)

func GetLocalIP() (string, error) {
	conn, err := net.Dial("udp", "10.128.45.6:156")
	if err != nil {
		return "Can not get IP", err
	}
	defer conn.Close()
	localAddr := conn.LocalAddr().(*net.UDPAddr)
	return strings.Split(localAddr.String(), ":")[0], nil
}
